package org.linuxsogood.boot;

import java.io.*;

/**
 * @author liu.hongwei
 */
public class RuntimeTest {

    public static void main(String[] args) {
        Runtime runtime = Runtime.getRuntime();
        Process exec = null;
        InputStream inputStream = null;
        try {
            exec = runtime.exec("./start.sh http://www.baidu.com");
            inputStream = exec.getInputStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
            String content = null;
            while ((content = reader.readLine()) != null) {
                System.out.println("content = " + content);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (inputStream != null) {
                    inputStream.close();
                }
            } catch (IOException e) {
                inputStream = null;
            }
        }
    }
}
